package com.example.healthcondition.mapper;

import com.example.healthcondition.entity.ExerciseSuggestions;
import org.apache.ibatis.annotations.*;

import java.util.Map;

@Mapper
public interface ExerciseSuggestionsMapper {
    @Insert("INSERT INTO exercisesuggestions (user_id, suggestion_type, description, created_at) " +
            "VALUES (#{userId}, #{suggestionType}, #{description}, #{createdAt})")
    @Options(useGeneratedKeys = true, keyProperty = "suggestionId")
    int insertExerciseSuggestions(ExerciseSuggestions exerciseSuggestions);

    @Select("SELECT * FROM exercisesuggestions WHERE user_id = #{userId} ORDER BY created_at DESC LIMIT 1")
    Map<String, Object> findLatestByUserId(@Param("userId") Integer userId);
}